package com.mti.monitor.config;

import com.mti.monitor.rst.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result<?> handleException(Exception e) {
        // 这里可以根据不同类型的异常设置不同的错误码和消息
        return Result.error(500, "服务器内部错误");
    }
}
